package com.example.leave.dao;

import com.example.leave.entity.LeaveForm;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.List;

@Repository()
public interface LeaveRepository extends JpaRepository<LeaveForm, String>, JpaSpecificationExecutor<LeaveForm> {

    int deleteByIdIn(List<String> ids);


    Page<LeaveForm> findByCategoryLike(String category, Pageable pageable);

    Page<LeaveForm> findByReasonLike(String reason, Pageable pageable);

    Page<LeaveForm> findByUserIdAndStartTimeBetween(String userId, Timestamp start, Timestamp end, Pageable pageable);


    Page<LeaveForm> findByStartTimeBetween(Timestamp start, Timestamp end, Pageable pageable);

}
